﻿@{
    ViewBag.title = "收件箱";
    List<Message> messages = ViewBag.messages;
    int page = ViewBag.page;
    int totalPageNumber = ViewBag.pageNumber;
    Layout = "~/Views/Shared/_layout.cshtml";
}
@section sidebar {
    @Html.Partial("_sidebar")
}
<ul class="list-group es-news-list">
    <li class="list-group-item">
        <div class="row">
            <div class="col-md-2">
                发件人
            </div>
            <div class="col-md-10">
                消息标题
            </div>
        </div>
    </li>
    @foreach (var message in messages)
    {
        <li class="list-group-item">
            <div class="row">
                <div class="col-md-2">
                    <a href="/User/Profile/@message.sender">@UserView.GetUserById((int)message.sender).name</a>
                </div>
                <div class="col-md-10">
                    @if (message.read)
                    {
                        <a href="/Message/Detail/@message.mid">@message.title</a>
                    }
                    else
                    {
                        <b><a href="/Message/Detail/@message.mid">@message.title</a></b>
                    }
                </div>
            </div>
        </li>
    }
</ul>
<br />
<div class="es-pager">
    @if (page > 1)
    {
        <a class="btn btn-sm btn-primary es-pager-previous" href="/News/Index/@(page - 1)">上一页</a>
    }
    else
    {
        <a class="btn btn-sm btn-primary es-pager-previous disabled" href="#">上一页</a>
    }
    <div class="es-pager-num">第 @page 页</div>
    @if (page < totalPageNumber)
    {
        <a class="btn btn-sm btn-primary es-pager-next" href="/News/Index/@(page + 1)">下一页</a>
    }
    else
    {
        <a class="btn btn-sm btn-primary es-pager-next disabled" href="#">下一页</a>
    }
</div>